package com.cskaoyan.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * 应用程序启动的入口
 * @author stone
 * @date 2022/12/26 11:03
 */
public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {//初始化Listener的WebApplicationContext读取的配置类
        //实际上做的就是这样的事情 new AnnotationConfigWebApplicationContext(RootConfiguration.class);
        return new Class[]{RootConfiguration.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {//初始化DispatcherServlet的WebApplicationContext读取的配置类
        //实际上做的就是这样的事情 new AnnotationConfigWebApplicationContext(ServletConfiguration.class);
        return new Class[]{ServletConfiguration.class};
    }

    @Override
    protected String[] getServletMappings() {// 配置DispatcherServlet的url-pattern → /
        return new String[]{"/"};
    }

}
